package com.sinog.biz.service.business.impl;

import com.sinog.biz.mapper.havexml.other.AzbjRsMapper;
import com.sinog.biz.service.business.AzbjRsService;
import com.sinog.core.domain.AzbjRsVo;
import com.sinog.core.util.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @desc AzbjRs统计mapper
 * @author wangxj
 * @date 2021-01-13 19:05
 */
@Service
public class AzbjServiceImpl implements AzbjRsService {

    @Autowired
    private AzbjRsMapper azbjRsMapper;

    /**
     * 描述
     * @param nativepro nativepro
     */
    @Override
    public Integer updateRs(String nativepro) {
        List<AzbjRsVo> azbjRsVos = JsonUtil.toList(nativepro,AzbjRsVo.class);
        return azbjRsMapper.updateRs(azbjRsVos);
    }

    /**
     * 定时任务,添加统计图指标
     * @param localCode localCode
     * @param filed filed
     * @param count count
     * @return Integer
     */
    @Override
    public Integer insertAzbjRs(String localCode, String filed, Integer count) {
        return azbjRsMapper.insertAzbjRs(localCode,filed,count);
    }

    /**
     * 定时任务，根据localCode和field删除azbj_rs表中的数据
     * @param localCode 省份编码前两位
     * @param field 字段名称
     * @return 删除数量
     */
    @Override
    public Integer deleteAzbjRs(String localCode,String field) {
        return azbjRsMapper.deleteAzbjRs(localCode, field);
    }

    /**
     * 批量新增azbjRs
     * @param toJsonString toJsonString
     */
    @Override
    public void batchInsertAzbjRs(String toJsonString) {
        List<AzbjRsVo> azbjRsVos = JsonUtil.toList(toJsonString,AzbjRsVo.class);
        azbjRsMapper.batchInsertAzbjRs(azbjRsVos);
    }
}